package com.wz.project.system.ssj.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wz.framework.aspectj.lang.annotation.Log;
import com.wz.framework.aspectj.lang.enums.BusinessType;
import com.wz.project.system.ssj.domain.DeviceAgvSsj;
import com.wz.project.system.ssj.service.IDeviceAgvSsjService;
import com.wz.framework.web.controller.BaseController;
import com.wz.framework.web.domain.AjaxResult;
import com.wz.common.utils.poi.ExcelUtil;
import com.wz.framework.web.page.TableDataInfo;

/**
 * AGV入库输送机管理Controller
 * 
 * @author wz
 * @date 2023-12-23
 */
@Controller
@RequestMapping("/system/ssj")
public class DeviceAgvSsjController extends BaseController
{
    private String prefix = "system/ssj";

    @Autowired
    private IDeviceAgvSsjService deviceAgvSsjService;

    @RequiresPermissions("system:ssj:view")
    @GetMapping()
    public String ssj()
    {
        return prefix + "/ssj";
    }

    /**
     * 查询AGV入库输送机管理列表
     */
//    @RequiresPermissions("system:ssj:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(DeviceAgvSsj deviceAgvSsj)
    {
        startPage();
        List<DeviceAgvSsj> list = deviceAgvSsjService.selectDeviceAgvSsjList(deviceAgvSsj);
        return getDataTable(list);
    }

    /**
     * 导出AGV入库输送机管理列表
     */
    @RequiresPermissions("system:ssj:export")
    @Log(title = "AGV入库输送机管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(DeviceAgvSsj deviceAgvSsj)
    {
        List<DeviceAgvSsj> list = deviceAgvSsjService.selectDeviceAgvSsjList(deviceAgvSsj);
        ExcelUtil<DeviceAgvSsj> util = new ExcelUtil<DeviceAgvSsj>(DeviceAgvSsj.class);
        return util.exportExcel(list, "ssj");
    }

    /**
     * 新增AGV入库输送机管理
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存AGV入库输送机管理
     */
    @RequiresPermissions("system:ssj:add")
    @Log(title = "AGV入库输送机管理", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(DeviceAgvSsj deviceAgvSsj)
    {
        return toAjax(deviceAgvSsjService.insertDeviceAgvSsj(deviceAgvSsj));
    }

    /**
     * 修改AGV入库输送机管理
     */
    @GetMapping("/edit/{name}")
    public String edit(@PathVariable("name") String name, ModelMap mmap)
    {
        DeviceAgvSsj deviceAgvSsj = deviceAgvSsjService.selectDeviceAgvSsjById(name);
        mmap.put("deviceAgvSsj", deviceAgvSsj);
        return prefix + "/edit";
    }

    /**
     * 修改保存AGV入库输送机管理
     */
    @RequiresPermissions("system:ssj:edit")
    @Log(title = "AGV入库输送机管理", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(DeviceAgvSsj deviceAgvSsj)
    {
        return toAjax(deviceAgvSsjService.updateDeviceAgvSsj(deviceAgvSsj));
    }

    /**
     * 删除AGV入库输送机管理
     */
    @RequiresPermissions("system:ssj:remove")
    @Log(title = "AGV入库输送机管理", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(deviceAgvSsjService.deleteDeviceAgvSsjByIds(ids));
    }
}
